<?php
class Commodity_model extends CI_Model {
    function __construct()
    {
        parent::__construct();
    }
    function searchList(){
    	$query = "SELECT * FROM COMMODITY_HEADER ";
    	return $this->db->query($query)->result();
    }

    function search_detail($sku_code){
//     	$query = "SELECT CD.* FROM COMMODITY_HEADER CH INNER JOIN COMMODITY_DETAIL CD  
//     			ON CH.SHOP_CODE=CD.SHOP_CODE AND CH.COMMODITY_CODE = CD.COMMODITY_CODE 
//     			WHERE CD.SHOP_CODE = ? AND CD.SKU_CODE = ? " ;

    	$query = "SELECT CH.*,CD.* FROM COMMODITY_HEADER CH INNER JOIN COMMODITY_DETAIL CD
    			ON CH.SHOP_CODE=CD.SHOP_CODE AND CH.COMMODITY_CODE = CD.COMMODITY_CODE
    			WHERE CD.SHOP_CODE = ? AND CD.COMMODITY_CODE = ? LIMIT 1 " ;
    	 
    	
    	//return $this->db->query($query)->result();
    	//return $this->db->query($query, array($shop_code, '$sku_code))->result();
    	return $this->db->query($query, array('0000', $sku_code))->row();
    	 
    }
    
    
}